const url = 'http://sample.com/?a=1&b=2&c=xx&d#hash'
const arr = url.split('?').pop().split('#').shift().split('&')
let obj = {}
arr.forEach((item) => {
  const [k, v] = item.split('=')
  obj[k] = v
  if (obj[k] === undefined) {
    return (obj[k] = '')
  }
  return obj
})
